import numpy
import talib

a = [17.64, 17.59, 17.65]

rsi = talib.RSI(numpy.array(a), 2)
print(rsi)

import pandas as pd

import numpy as np

import matplotlib.pyplot as plt


#正常显示画图时出现的中文和负号

from pylab import mpl

mpl.rcParams['font.sans-serif']=['SimHei']

mpl.rcParams['axes.unicode_minus']=False

#引入TA-Lib库

import talib as ta

#查看包含的技术指标和数学运算函数

#print(ta.get_functions())

#print(ta.get_function_groups())

ta_fun=ta.get_function_groups()

ta_fun.keys()

#使用tushare获取上证指数数据作为示例

import tushare as ts

df=ts.get_k_data('000001',start='2021-01-01')
print(df.head(20))
df.index=pd.to_datetime(df.date)

df=df.sort_index()

types=['SMA','EMA','WMA','DEMA','TEMA',

'TRIMA','KAMA','MAMA','T3']
print(df)
# H_line,M_line,L_line=ta.BBANDS(df.close, timeperiod=13, nbdevup=2, nbdevdn=2, matype=0)
# print(H_line,M_line,L_line)
real = ta.ATR(df.high, df.low, df.close, timeperiod=10)
print(real.head(20))
import funcat
# foriinrange(len(types)):
#
# df_ma[types[i]]=ta.MA(df.close,timeperiod=5,matype=i)
#
# df_ma.tail()
#
# df_ma.loc['2018-08-01':].plot(figsize=(16,6))
#
# ax = plt.gca()
#
# ax.spines['right'].set_color('none')
#
# ax.spines['top'].set_color('none')
#
# plt.title('上证指数各种类型移动平均线',fontsize=15)
#
# plt.xlabel('')
#
# plt.show()

"""作者：CuteHand
链接：https://www.jianshu.com/p/7ecc7962d638
来源：简书
著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"""